<template>
  <div>

    <ul>
      <li v-for="item in list" :key="item.id">
        <img :src="`${item.picUrl}?param=123y123`"/>
        <p>{{ item.name }}</p>
        <!--        <p>{{ item.playCount>99999999?(item.playCount/100000000).toFixed(2)+"亿":(item.playCount/10000).toFixed(2)+"万" }}</p>-->
        <p class="num">{{ onlineAudience(item.playCount) }}</p>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  name: "RecommendThePlaylist",
  props: {
    list: Array
  },
  created() {
    // console.log(this.list)
  },
  methods: {
    onlineAudience(num) {
      if (num.toString().length > 8) {
        return (num / 100000000).toFixed(2) + "亿"
      }else if(num.toString().length>4){
        return (num / 10000).toFixed(2) + "万"
      }

    }
  }
}
</script>

<style scoped lang="less">

ul {
  list-style: none;

  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;

  li {
    width: 33%;
    position: relative;

    p {
      font-size: 14px;

      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .num {
      font-size: 12px;
      margin: 0px;
      color: #fff;
      position: absolute;
      top: 0;
      right: 0;
    }
  }
}

</style>